class Solution:
    def longestCommonPrefix(self, strs: list[str]) -> str:
        flag = 0
        MIN_LENG = len(strs[0])
        for i in strs:
            if len(i) < MIN_LENG:
                MIN_LENG = len(i)
        while flag < MIN_LENG:
            s = strs[0][flag]
            for i in strs:
                if i[flag] != s:
                    return strs[0][:flag]
            flag += 1
        return strs[0][:flag]
        
if __name__ == '__main__':
    s = Solution()
    print('"'+s.longestCommonPrefix(["flower", "flow", "flight"])+'"')
    print('"'+s.longestCommonPrefix(["dog", "racecar", "car"])+'"')
    print('"'+s.longestCommonPrefix(["c", "acc", "ccc"])+'"')
    print('"'+s.longestCommonPrefix(["", "aasdas"])+'"')